<!DOCTYPE html>
<extend name="Base/base" />
<block name='head'>  
    <meta charset="utf-8">
    <!--文件上传-->
    <script type="text/javascript" src="__PUBLIC__/Cropper/js/ajaxfileupload.js" ></script>
    <link href="/Public/Index/css/workflow.css" rel="stylesheet" /> 
    <style type="text/css">
        .t4{color:#bbb}
        /*出差小结－转交下一步骤开始*/
        .trip_title h2 {
            font-size:1.2em;
            margin:1.2em;
            color:#5077aa;
        }
        .trip_next h3{
            font-size:1em;
            padding:0.8em;
        }
        .trip_next table{
            width:100%;
            /*border:1px solid red;*/
        }
        .trip_next table tr td{
            border:1px solid #CFDDEA;
            font-size:1.0em;
            padding:0.3em 0;
            /*text-align: center;*/
        }
        .trip_next table .value{
            width:80%;
            text-align: left;
            padding-left:10px;
        }
        .trip_next table .key{
            width:20%;
            text-align: center;
            background: #F0F0F0;
        }
        .trip_next table .value .textarea {
            display: inline-block;
            height: 4em;
        }
        .trip_next table .value input, .textarea, select, textarea {
            width: 60%;
            padding: 0.3em;
            background: #fff;
            border: 1px solid #efefef;
        }
        .trip_next table .value .addUser, .addDept, .addPriv {
            color: #437dba;
        }
        .pointer {
            cursor: pointer;
        }
        .top{
            height:5px;
        }
        .bottom{
            height:20px;
        }
        .comments{
            border:3px solid #CFDDEA;
        }
        .com1 {
            width:10%;
            font-weight:inherit;
            text-align:left;
        }

        .fil{
            border:1px solid #CFDDEA;
        }
        .submit_tj {
            width: 95%;
            margin: 3.5rem auto;
            clear: both;
        }
        .submit_tj input {
            height: 4rem;
            width: 100%;
            font-size: 1rem;
            border: none;
            border-radius: 6px;
        }
        .submit_tj input.sub_tj {
            background: #267DCE;
            color: #fff;
        }
        </style>
    </block>
    <block name="content" > 
        <form>
            <input type="hidden" name="news_id" value="{$_GET.news_id}">
            <div class="bd">
                <div class="trip_title">
                    <h2>新建新闻</h2>
                </div>
                <div class="work_cells trip_next">
                    <table>
                        <tr>
                            <td class="key">新闻标题</td>
                            <td class="value"><input type='text' name='subject' value="{$new.subject}" style='border:1px solid #CFDDEA;width:90%;' speech x-webkit-speech  /></td>
                        </tr>
                        <tr>
                            <td class="key">新闻类型</td>
                            <td class="value">
                                <select name="type_id" style='border:1px solid #CFDDEA;width:93.9%;'>
                                    <if condition="$new.type_id eq 1"> 
                                        <option value="1" selected>公司新闻</option>
                                        <option value="2" >行业新闻</option>
                                        <else />
                                        <option value="1" >公司新闻</option>
                                        <option value="2" selected>行业新闻</option>
                                    </if>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td class="key">按部门发布<p style="color:#437dba" class="pointer" id="href_txt">按人员或角色发布</p></td>
                            <td class="value">
                                <p class="textarea depart"><span></span></p>
                                <a class="pointer addDept">+添加 </a>
                                <a class="pointer delData">-清空</a>
                            </td>
                        </tr>
                        <tr id="rang_user" style="display:none;">
                            <td class="key">按人员发布</td>
                            <td class="value">
                                <p class="textarea"><span></span></p>
                                <a class="pointer addUser addUser_1" data-id="1" data-key="user_id">+添加 </a>
                                <a class="pointer delData">-清空</a>
                            </td>
                        </tr>
                        <tr id="rang_role" style="display:none;">
                            <td class="key">按角色发布</td>
                            <td class="value">
                                <p class="textarea priv"><span></span></p>
                                <a class="pointer addPriv" data-id="2" data-key="priv_id">+添加 </a>
                                <a class="pointer delData">-清空</a>
                            </td>
                        </tr>
                        <tr>
                            <td class="key">评论</td>
                            <td class="value">
                                <select name="anonymity_yn" style='border:1px solid #CFDDEA;width:93.9%;'>
                                    <if condition="$new.anonymity_yn eq 0"> 
                                        <option value="0" selected>实名评论</option>
                                        <option value="1" >匿名评论</option>
                                        <option value="2" >禁止评论</option>
                                        <elseif condition="$new.anonymity_yn eq 1"/>
                                        <option value="0" >实名评论</option>
                                        <option value="1" selected>匿名评论</option>
                                        <option value="2" >禁止评论</option>
                                        <elseif condition="$new.anonymity_yn eq 2"/>
                                        <option value="0" >实名评论</option>
                                        <option value="1" >匿名评论</option>
                                        <option value="2" selected>禁止评论</option>
                                    </if>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td class="key">新闻内容</td>
                            <td class="value">
                                <textarea name="content" style="width:93%;height:18em;border:1px solid #CFDDEA;">{$new.content}</textarea>
                            </td>
                        </tr>
                        <tr class="up">
                            <td class="key">新闻图片</td>
                            <td class="value">
                                <div>
                                    <a class="pointer" id="upload" style="color:#437dba;">+ 上传图片</a>
                                </div>
                                <div class="line filename-cont">
                                    <if condition="$uploads neq null">
                                        <foreach name="uploads" item="img">
                                            <span>
                                                <img src="{$img.url}" style="width:100px">
                                                <img src="/Public/Index/img/close.png" style="width:15px" class="pointer delfile" data-fileurl="{$img.url}"/>
                                            </span><br/>
                                        </foreach>
                                    </if>
                                </div>
                                <input type="file" id="inputImage" name='imgfile' style="display:none">
                                    <!--<input type="hidden" id="filename" name="uploads" value="{$new.uploads}">-->
                                    <input type="hidden" id="fileurl" name="uploads_url" value="{$new.uploads_url}">
                                    <input type="hidden" name="url" value="{:U('delFile')}">
                                </td>
                            </tr>
                        </table>
                        <!--                <div class="up" style="">
                                            <div class="line">新闻图片</div>
                                            <div class="line pointer"><a id="upload" style="color:#437dba;">+ 上传图片</a></div>
                                            <div class="line filename-cont">
                                                <if condition="$upload[0]['name'] neq null">
                                                    <foreach name="upload" item="row" key="key">
                                                        <if condition="$row neq null and !is_string($key)">
                                                            <span><a href="{$row.upload}" download="{$row.name}">{$row.name}</a><img src="/Public/Index/img/close.png" class="pointer delfile" data-fileurl="{$row.upload}"/></span><br/>
                                                        </if>
                                                    </foreach>
                                                </if>
                                            </div>
                                            <if condition="$upload['pcNames'][0] neq null">
                                                <div class="line">
                                                    <span style="color:red;font-size:0.6em;font-weight:bold">PC端上传的文件暂不支持阅览，请在电脑上打开！</span><br/>
                                                    <foreach name="upload.pcNames" item='pc'>
                                                        <span style="color:gray">{$pc}</span><br/>
                                                    </foreach>
                                                </div>
                                            </if>
                                            <input type="file" id="inputImage" name='imgfile' style="display:none">
                                                <input type="hidden" id="filename" name="uploads" value="{$new.uploads}">
                                                <input type="hidden" id="fileurl" name="uploads_url" value="{$new.uploads_url}">
                                                <input type="hidden" name="url" value="{:U('delFile')}">
                                        </div>            -->
<!--                        <div class="button" style="margin-left:23%;">
                            <span>
                                <a class="pointer btn-submit ajax-post" data-verify="all" data-url="{:U('addNews')}" data-form="">提交</a>
                                <a class="pointer btn-submit ajax-post" data-verify="all" data-url="{:U('addDiary',array('DIA_TYPE'=>1))}" data-form="">保存</a>
                            </span>
                        </div>-->
                        
                </div>
        </form>
        <p class="bottom"></p>
<!--        <div class="button">
            <a class="am-btn" onclick="history.go(-1)">返 回</a>
        </div>-->
        <div class="submit_tj">
            <p><input type="button" class="sub_tj pointer btn-submit ajax-post" data-url="{:U('addNews')}" data-form="" value="提&nbsp;&nbsp; 交" ></p>
            <!--<p><input type="button" class="sub_bc pointer btn-submit ajax-post" data-url="{:U('addPlan',array('type'=>1))}" data-form="" value="保&nbsp;&nbsp; 存" ></p>-->
        </div>

    </block>
    <block name="script">
        <script type="text/javascript" src="/Public/Index/js/form.js"></script>
        <script type="text/javascript" src="/Public/Index/js/news.js"></script>
        <script type="text/javascript" src="/Public/Index/js/plan.js"></script>
        <script type="text/javascript">
            $('#href_txt').on('click',function(){
                var pra = $('#href_txt').text().indexOf("隐藏");
                if(pra < 0 ){
                    $('#rang_user').show();
                    $('#rang_role').show();
                    $('#href_txt').text("隐藏按人员或角色发布");
                }else{
                    $('#rang_user').hide();
                    $('#rang_role').hide();
                    $('#href_txt').text("按人员或角色发布");
                }
            })
            $(initAddPlan());
            $(initUpload("{:U(CONTROLLER_NAME.'/upload')}"));
        </script>
    </block>
